﻿using AutoMapper;
using Common.Property;
using Common.Utility;
using DTO;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Web.Framework;

namespace Web.Controllers
{
    public class BaseController : Controller
    {
        public string SitePath { get { return AppSetting.GetAppSetting("SitePath"); } }

        public HttpContext _HttpContext { get; set; }
        public IMapper _mapper { get; set; }

        public BaseController()
        {
        }
        public BaseController(IHttpContextAccessor httpContextAccessor, IMapper mapper)
        {
            _HttpContext = httpContextAccessor.HttpContext;
            _mapper = mapper;
        }

        public OperatorInfo OperatorInfo
        {
            get
            {
                return new OperatorInfo
                {
                    UserId = UserInfo.UserId
                };
            }
        }

        public UserInfo UserInfo
        {
            get
            {
                return new UserInfo(_HttpContext);
            }
        }
    }
}